<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<html>
	<head>
		<title>密码修改</title>
		<style type="text/css">
		td {
			font-family: Arial, Helvetica, sans-serif;
			font-size: 12px;
			font-style: normal;
			font-weight: normal;
			color: #FFFFFF;
		}
		</style>	
	</head>
	<script type="text/JavaScript"	src="<%= basePath %>static/admin/js/common.js"></script>
	<link href="<%= basePath %>static/admin/css/all.css" rel="stylesheet" type="text/css" />
	<body leftmargin="0" topmargin="0" rightmargin="0" bottommargin="0" marginwidth="0" marginheight="0">
	<table width="100%" border="0" cellpadding="0" cellspacing="1" bgcolor="#66CCFF">
		<s:form id="resetPassword" action="resetPassword" theme="simple" target="_top">
		<s:token />
		<tr>
			<td bgcolor="#2C81B8" height="30px" align="right">请输入原密码：</td>
			<td bgcolor="#2C81B8"><s:password name="oldpassword" id="oldpassword"/></td>
		</tr>
		<tr>
			<td bgcolor="#2C81B8" height="30" align="right">请输入新密码：</td>
			<td bgcolor="#2C81B8"><s:password name="newpassword" id="newpassword"/>
			</td>
		</tr>
		<tr>
		  <td bgcolor="#2C81B8" height="30px" align="right">请再次输入新密码：</td>
		  <td bgcolor="#2C81B8"><s:password name="renewpassword" id="renewpassword"/></td>
		</tr>
		<tr>	
		  <td bgcolor="#2C81B8" height="30px" align="right"><input type="button" class="backButton"  value="确定" onClick="resetPasswordFormSubmit();"></td>
		  <td bgcolor="#2C81B8"><input type="button" value="取消" class="backButton"  onClick="javascript:history.go(-1);"></td>
		</tr>
		</s:form>
	</table>
</html>
<script type="text/javascript">
window.onload = function(){
	var ifrm = parent.document.getElementById("backIframe");	
	ifrm.height = 125;
}

function resetPasswordFormSubmit(){
    var oldpassword=document.getElementById("oldpassword").value;
    var newpassword = document.getElementById("newpassword").value;
    var renewpassword=document.getElementById("renewpassword").value;
    
	if(!checkInputEmpty("oldpassword")){
		alert("原密码不能为空！")
		return ;
	}else if(!checkInputEmpty("newpassword")){
		alert("新密码不能为空！")
		return ;
	}else if(!checkInputEmpty("renewpassword")){
		alert("重复新密码不能为空！")
		return ;
	}else if(!checkInputLen("newpassword", 4, 20)){
		alert("新密码长度不符合要求!")
		return ;
	}
	
	if(newpassword!=renewpassword)
	{
	   alert("输入的两次新密码不相同!");
	   return;
	}
	
	var resetPasswordForm = document.getElementById("resetPassword");
	resetPasswordForm.submit();
}
</script>